# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=dos2unix
pkgver=7.3.2
pkgrel=1
pkgdesc='Text file format converter'
arch=('i686' 'x86_64')
url='http://waterlan.home.xs4all.nl/dos2unix.html'
license=('BSD')
depends=('libintl')
groups=('base-devel')
makedepends=('perl' 'gettext-devel')
conflicts=('hd2u')
source=("http://waterlan.home.xs4all.nl/${pkgname}/${pkgname}-${pkgver}.tar.gz"
        0001-msysize.msys2.patch)
sha256sums=('c7e8ee0bb3e001cc25a4a908d9a81ac52d124133d6a524a59f995bc90d438689'
            '4b6b05cbe47ba4a2c66a7464ebe102de4d00b21e6e3b54266354eb756b0ae9c4')

prepare() {
  cd ${srcdir}/${pkgname}-${pkgver}
  patch -p1 -i ${srcdir}/0001-msysize.msys2.patch
}

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make
}

package() {
  cd ${srcdir}/${pkgname}-${pkgver}
  make DESTDIR=${pkgdir} install
  install -Dm755 ${pkgdir}/usr/bin/dos2unix.exe ${pkgdir}/usr/bin/d2u.exe
  install -Dm755 ${pkgdir}/usr/bin/unix2dos.exe ${pkgdir}/usr/bin/u2d.exe
  install -D -m644 COPYING.txt ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
}
